package proyecto;

import java.util.ArrayList;
import org.umlviewer.model.Relationship;
import org.umlviewer.model.UmlDiagram;
import org.umlviewer.model.sequence_diagram.Message;

/**
 *Clase prueba para hacer test sobre el diagram
 * @author Rafa
 */
public class TestDiagram {

    private UmlDiagram diagram;
    
    public TestDiagram(UmlDiagram d){
        this.diagram = d;
    }
    
    public void setDiagram(UmlDiagram d){
        this.diagram = d;
    }
    
    public void showMessages(){
        System.out.println("LLamado");
        ArrayList<Relationship> rels = diagram.getRelationships();
        for(Relationship r : rels){
            if(r instanceof Message){
                Message m = (Message)r;
                System.out.println("Origen "+m.getSource().getName());
                System.out.println("Dest "+m.getDestination().getName());
                System.out.println("Mensaje "+m.getName());
                System.out.println("--------");
            }
        }
    }
    
    public void showRelations(){
        System.out.println("Mostrando relaciones");
        ArrayList<Relationship> rels = diagram.getRelationships();
        for(Relationship r: rels){
            System.out.println("De "+r.getSource().getName());
            System.out.println("A "+r.getDestination().getName());
            System.out.println("Tipo "+r.getType()+" Label: "+r.getLabel());
            System.out.println("------------");
        }
    }
    
}
